package nextoffer.mihayou;

import java.util.Scanner;

public class Second {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int xue = in.nextInt();
        int [][] arr= new int[n][2];
        for(int i = 0; i < n;i++){
            arr[i][0] = in.nextInt();
            arr[i][1] = in.nextInt();

        }
        int lucky = 0;
        int demage = 0;
        for(int i = 0; i < n;i++){

            if(arr[i][0] == 1){
                lucky +=arr[i][1];
            } else {
                demage += arr[i][1];
            }
        }

    }
}/*
5
 15
        1 1
        1 2
        1 1
        2 1
        2 1*/